Skip to content

Revert SQL Server Application Name injection - #39700

Merged
AndriySvyryd merged 1 commit into
mainfrom
dev/cheena/revert-application-name-injection
Nov 17, 2026
Merged

AndriySvyryd merged 1 commit into
mainfrom
dev/cheena/revert-application-name-injection

Conversation

@cheenamalhotra

@cheenamalhotra cheenamalhotra commented Nov 17, 2026 •

Copy link
Copy Markdown
Member
  • I've read the guidelines for contributing and seen the walkthrough
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Reverts #36548
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

Reverts #36548, adapted for intervening changes. Stacked on #39698; review this layer against dev/cheena/sql-connection-telemetry.

Removes connection-string Application Name injection and its rewrite cache. Restores exact master-connection string assertions, removes the two-database interceptor skip, and removes the dummy Application Name workaround. Regression coverage verifies unchanged connection strings for absent, empty, SqlClient-default, and custom application names, both on construction and reassignment.

Preserves the parent's RegisteredApplication.EntityFrameworkCore telemetry for EF-created runtime, master, and scaffolding connections, without changing user-supplied connections. Only internal implementation members are removed; there are no public API baseline changes.

Validation (Windows, repository-pinned .NET 12 SDK; native MTP command mode):

  • .\restore.cmd — passed.
  • . .\activate.ps1; dotnet test --project .\test\EFCore.SqlServer.Tests\EFCore.SqlServer.Tests.csproj --filter-class '*SqlServerConnectionTest' --verbosity quiet — passed: 11 succeeded, 0 failed, 0 skipped. Before the implementation change, this same command reproduced 5 assertion failures (3 application-name cases and 2 master-connection cases).
  • . .\activate.ps1; dotnet test --project .\test\EFCore.SqlServer.FunctionalTests\EFCore.SqlServer.FunctionalTests.csproj --filter-class '*TwoDatabasesSqlServerTest' --verbosity quiet — passed against LocalDB: 4 succeeded, 0 failed, 0 skipped, including restored interceptor coverage.
  • git --no-pager diff --check — passed.

The full suite was not run; the build/tests checklist remains unchecked pending CI. No blockers.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are present, and the changes include regression coverage for connection-string behavior and telemetry registration.

No open issues 🎉

What changed in this PR

This pull request reverts SQL Server connection-string Application Name rewriting while preserving EF Core telemetry through RegisteredApplication.EntityFrameworkCore on EF-created connections.

Changes:

  • Removes connection-string rewriting, its cache, and obsolete implementation members.
  • Restores exact master-connection string behavior and two-database interceptor coverage.
  • Adds regression coverage for absent, empty, default, and custom application names during construction and reassignment.
File Description
test/​EFCore.SqlServer.Tests/​Storage/​Internal/​SqlServerConnectionTest.cs Adds regression tests verifying unchanged connection strings, master-connection behavior, and telemetry registration across application-name scenarios.
test/​EFCore.SqlServer.FunctionalTests/​TwoDatabasesSqlServerTest.cs Restores SQL Server interceptor coverage and removes the dummy Application Name workaround.
src/​EFCore.SqlServer/​Storage/​Internal/​SqlServerConnection.cs Removes SQL Server connection-string Application Name injection and its rewrite cache while preserving EF Core telemetry registration.

Review effort: Lite

@github-code-quality

github-code-quality Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage

main 5bfb0ba dev/cheena/revert-ap... 4303bd8 +/-
76% 76% 0%
View coverage of the 10 most impacted files.
File main 5bfb0ba dev/cheena/revert-ap... 4303bd8 +/-
src/EFCore.Rela...deExtensions.cs 99% 99% 0%
src/EFCore.Cosm...nsExtensions.cs 82% 82% 0%
src/EFCore.Cosm...ionExtension.cs 100% 100% 0%
src/EFCore.Desi...CSharpHelper.cs 96% 96% 0%
src/EFCore.Desi...eportHandler.cs 47% 47% 0%
src/EFCore.Desi...elExtensions.cs 98% 98% 0%
src/EFCore.Desi...ionGenerator.cs 100% 100% 0%
src/EFCore.Desi...onsGenerator.cs 100% 100% 0%
src/EFCore.Rela...alConnection.cs 93% 94% +1%
src/EFCore.Sqli...ryRepository.cs 91% 97% +6%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 17, 2026 22:27 UTC

Base automatically changed from dev/cheena/sql-connection-telemetry to main November 17, 2026 21:57
- Preserve connection strings without injecting EF Core version and platform details.
- Restore interceptor coverage and retain registered-application telemetry from the parent layer.

Reverts #36548

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@cheenamalhotra
cheenamalhotra force-pushed the dev/cheena/revert-application-name-injection branch from 1190ff1 to 4303bd8 Compare November 17, 2026 21:57
@AndriySvyryd
AndriySvyryd merged commit f7bee10 into main Nov 17, 2026
22 checks passed
@AndriySvyryd
AndriySvyryd deleted the dev/cheena/revert-application-name-injection branch November 17, 2026 22:28
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants